<template>
    <section>
        <el-table :data="tableData" style="width: 100%">
            <el-table-column label="防区" prop="main"></el-table-column>
            <el-table-column label="防区状态" prop="safeOn">
                <template slot-scope="scope">
                    <div>
                        {{scope.row.safeOn?'撤防':"布防"}}
                    </div>
                </template>
            </el-table-column>
            <el-table-column label="防区报警" prop="alarmOn">
                <template slot-scope="scope">
                    <div>
                        {{scope.row?'报警':"正常"}}
                    </div>
                </template>
            </el-table-column>
            <el-table-column label="实时状态" prop="realTimeOn">
                <template slot-scope="scope">
                    <div>
                        {{scope.row?'触发':"正常"}}
                    </div>
                </template>
            </el-table-column>
            <!-- <el-table-column label="防区" prop="main"></el-table-column> -->
           <!--  <el-table-column label="布防状态" prop="devStatusOn1">
                <template slot-scope="scope">
                    <div>
                        {{scope.devStatusOn1?'撤防':'布防'}}
                    </div>
                </template>
            </el-table-column>
            <el-table-column label="紧急求助" prop="devStatusOn2">
                <template slot-scope="scope">
                    <div>
                        {{scope.devStatusOn2?'求助':'正常'}}
                    </div>
                </template>
            </el-table-column>
            <el-table-column label="被撬" prop="devStatusOn3">
                <template slot-scope="scope">
                    <div>
                        {{scope.devStatusOn3?'被撬':'正常'}}
                    </div>
                </template>
            </el-table-column>
            <el-table-column label="留守布防" prop="devStatusOn4">
                <template slot-scope="scope">
                    <div>
                        {{scope.devStatusOn4?'留守':'正常'}}
                    </div>
                </template>
            </el-table-column>
            <el-table-column label="交流状态" prop="devStatusOn5">
                <template slot-scope="scope">
                    <div>
                        {{scope.devStatusOn5?'ac有 ':'ac无'}}交流状态
                    </div>
                </template>
            </el-table-column>
            <el-table-column label="测试（检修）模式" prop="devStatusOn6">
                <template slot-scope="scope">
                    <div>
                        {{scope.devStatusOn6?'测试（检修模式）':'工作'}}
                    </div>
                </template>
            </el-table-column>
            <el-table-column label="直流欠压" prop="devStatusOn7">
                <template slot-scope="scope">
                    <div>
                        {{scope.devStatusOn7?'欠压直流欠压':'正常'}}
                    </div>
                </template>
            </el-table-column>
            <el-table-column label="备用" prop="devStatusOn8">
                <template slot-scope="scope">
                    <div>
                        {{scope.devStatusOn8?'备用':'备用'}}
                    </div>
                </template>
            </el-table-column> -->
        </el-table>
    </section>
</template>

<script>
import { getAlarmStatus } from '../../url/api';
export default {
    data() {
        return {
            tableData: [],
        };
    },
    methods: {
        getList() {
            getAlarmStatus().then((res) => {
                if (res.data.ok) {
                    // let str = j==1?'safeOn':j==2?'alarmOn':'realTimeOn';
                    let stat = res.data.data[0];
                        for(var j = 1; j <= 8; j++){
                            let obj = {}
                            obj.main = '防区' + j
                            obj["safeOn"] = stat["safeOn"+j];
                            obj["alarmOn"] = stat["alarmOn"+j];
                            obj["realTimeOn"] = stat["realTimeOn"+j];
                            obj["devStatusOn"] = stat["devStatusOn"+j];
                            this.tableData.push(obj)
                        }
                }
            });
        },
    },
    mounted() {
        this.getList();
    },
};
</script>

<style>
</style>
